<template>
  <h2>{{ title }}</h2>
  <button @click.prevent="">emitChange</button>
</template>

<script lang="ts">
/** defineComponent 场景 */
import { defineComponent } from 'vue'
import type { PropType } from 'vue'
interface Book {
  title: string,
  year: 2000
}
export default defineComponent({
  props: {
    // msg: String
    book: Object as PropType<Book>
  },
  data () {
    return {
      title: 'defineComponent'
    }
  },
  emits: ['change'],
  setup(props, { emit }) {
    console.log('defineComponent setup: ', props.book)
    emit('change', props.book)
  }
})
</script>
